package org.koyad.portal.tags.core;

import org.koyad.portal.annotations.TagCordinates;
import org.koyad.portal.annotations.TagType;
import org.koyad.portal.constants.FrameworkConstants;
import org.koyad.portal.context.PistonContext;
import org.koyad.portal.tags.AbstractTag;
import org.koyad.portal.tags.TagUtils;

@TagCordinates (
	uri = FrameworkConstants.CORE_NAMESPACE,
	localName = "out",
	type = TagType.NOBODY
)
public class OutTag extends AbstractTag {
	@Override
	public void render() {
		PistonContext.getContext().getViewRoot().setCurrentTag(this);
		
		Object value = TagUtils.getValue(getAttributeValue("value"));
		getWriter().write(value.toString());
		
		if(null != this._parent) {
			PistonContext.getContext().getViewRoot().setCurrentTag(this._parent);
		}
	}
}
